from jsonpath import jsonpath

data = {
  "code": 0,
  "msg": "success",
  "data": {
    "user": {
      "id": 1001,
      "name": "Tom",
      "roles": ["admin", "tester"],
      "address": {
        "city": "Shanghai",
        "zipcode": "200000"
      }
    }
  }
}

# 提取 name
result = jsonpath(data, '$.data.user.name')
print(result)  # ['Tom']